"""
1、登录，得到 cookie
2、带着 cookie 去请求
"""

import requests

# 会话
session = requests.session()
url = 'https://passport.17k.com/ck/user/login'
headers = {
    'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36',
    'Referer': 'https://passport.17k.com/login/'
}
# headers = {
#     "Accept": "*/*",
#     "Accept-Encoding": "gzip, deflate, br, zstd",
#     "Accept-Language": "zh-CN,zh;q=0.9",
#     "Cache-Control": "no-cache",
#     "Connection": "keep-alive",
#     "Content-Length": "40",
#     "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
#     "Cookie": "GUID=5650f59a-3d71-4fa4-9202-9ae42cba1f51; c_channel=0; c_csc=web; Hm_lvt_9793f42b498361373512340937deb2a0=1748866230; HMACCOUNT=E1EE38BD49E745B9; sajssdk_2015_cross_new_user=1; acw_sc__v2=683da368b62a59750dfb818e5feed44a98fd2267; acw_tc=2760829317488702631843603e3e2972091356391e9880681257dfe1368e12; Hm_lpvt_9793f42b498361373512340937deb2a0=1748870351; sensorsdata2015jssdkcross=%7B%22distinct_id%22%3A%225650f59a-3d71-4fa4-9202-9ae42cba1f51%22%2C%22%24device_id%22%3A%22197308ce9964a0-0711e8f202e297-19525636-3686400-197308ce9971222%22%2C%22props%22%3A%7B%7D%2C%22first_id%22%3A%225650f59a-3d71-4fa4-9202-9ae42cba1f51%22%7D; ssxmod_itna=iuG=D5DKBIPfEDl8D+obHwuOpDuBDYqPcrWBGuPDsWfDSxGKidDqxBWnjFRObAweCFPnuoYo8rYO0mKCbOcjizCP2YGIDeKG2DmeDyDi5GRD0FeTD4SKGwD0eG+DD4DW4H9QDFIuKt1jYTQ6QktDm+Q0DGQRDit5xivg0MjSQeGWIqGfDDoDY8U98WdDGdKDbwdDIkU4lYx/neQaopQUtPDutpQPvqDLCWcTxB=0UCp9Kz7DtuQRIeQUD0PMAnjdNOGaio+z42e58EfqDYvx/AGxtOhbC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.17k.com",
#     "Origin": "https://passport.17k.com",
#     "Pragma": "no-cache",
#     "Referer": "https://passport.17k.com/login/",
#     "Sec-Ch-Ua": "\"Chromium\";v=\"136\", \"Google Chrome\";v=\"136\", \"Not.A/Brand\";v=\"99\"",
#     "Sec-Ch-Ua-Mobile": "?0",
#     "Sec-Ch-Ua-Platform": "\"macOS\"",
#     "Sec-Fetch-Dest": "empty",
#     "Sec-Fetch-Mode": "cors",
#     "Sec-Fetch-Site": "same-origin",
#     "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"
# }
param = {
    'loginName': '18739932773',
    'password': 'zyx123005'
}
# with requests.get('https://fx.corp.17k.com/sa.gif?token=Yzc3MTljNW&project=new_dp'): pass
# with requests.get('https://passport.17k.com/login', headers=headers):pass
# with requests.get('https://passport.17k.com/login/', headers=headers):pass
with session.post(url, param, headers=headers) as response:
    print(response.text)
    print(response.cookies)
    print(response.request.url)
    print(response.request.headers)
    print(response.request.body)
    with open('temp.html', 'w', encoding='utf-8') as f:
        f.write(response.text)
